//
//  LHRecommendSightViewController.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/13.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHRecommendSightViewController.h"
#import "LHRecommendSightView.h"
#import "LHRecommendSightDetailViewController.h"
#import "MyNavgationView.h"

@interface LHRecommendSightViewController ()<jumpSightDetailDelegate>

@end

@implementation LHRecommendSightViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithRed:0.871 green:0.962 blue:0.965 alpha:1.000];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self createSightTableView];
    
    [self createNavigation];
    
}

// 创建自定义导航栏
- (void)createNavigation
{
    MyNavgationView *myNaView = [[MyNavgationView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    
    [myNaView creatTitle:@""];
    
    myNaView.leftTarget = self;
    myNaView.leftAction = @selector(backToCityHomePageController);
    [myNaView creatLeftButtonWithImage:@"btn_nav_back"];
    
    
    
    [self.view addSubview:myNaView];
    
    [myNaView release];
    
}

- (void)backToCityHomePageController
{
    [self.navigationController popViewControllerAnimated:YES];
}


/**
 *  创建推荐景点tableView
 */
- (void)createSightTableView
{
    LHRecommendSightView *sightView = [[LHRecommendSightView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64) cityId:self.cityIdStr2];
    
    sightView.delegate = self;
    
    [self.view addSubview:sightView];
    
    [sightView release];
    
    
}
/**
 *  实现跳转到景点详情的协议方法
 */
- (void)jumpToSightDetailWithIndexPath:(NSIndexPath *)indexPath sightArr:(NSMutableArray *)sightArr
{
    LHRecommendSightDetailViewController *detailVC = [[[LHRecommendSightDetailViewController alloc] init] autorelease];
    
    detailVC.sightDetailModel = sightArr[indexPath.item];
    
    [self.navigationController pushViewController:detailVC animated:YES];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
